<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('品牌编辑')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" >
    <form class="form-horizontal m" id="form-article-edit" th:object="${product}">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">货品名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="name" id="name" required th:field="*{name}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">成本价格：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="price" id="price" required th:field="*{price}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">销售价格：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="salePrice" id="salePrice" required th:field="*{salePrice}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">编号：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="code" id="" required th:field="*{code}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">品牌：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="brand" required th:field="*{brand}">
            </div>
        </div>
      <!-- <div class="form-group">
            <label class="col-sm-3 control-label is-required">品牌：</label>
            <div class="col-sm-4">
                <select name="brand" class="form-control m-b" th:with="type=${@dict.getType('sys_article_brand')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictCode}"></option>
                </select>
            </div>
        </div>-->
      <!--  <div class="form-group">
            <label class="col-sm-3 control-label is-required">货品图片:</label>
            <div class="col-sm-8">
                <input type="file" name="picture" >
            </div>
        </div>-->
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "demo/work";

/*
    function submitHandler() {
       /!* if ($.validate.form()) {
            var file = $("[name='picture']")[0].files[0];
            if (!file) {
                $.modal.alertError("请选择图片");
                return;
            }
            //发送Ajax实现文件上传
            var fd = new FormData();
            //fd.append("picture",file);
            fd.append("name",$("[name='name']").val());
            fd.append("price",$("[name='price']").val());
            fd.append("code",$("[name='code']").val());
            fd.append("salePrice",$("[name='salePrice']").val());
            fd.append("brand",$("[name='brand']").val());
            // fd.append("brand",$("[name='brand'] option:selected").text());
            $.ajax({
                url:prefix+'/edit',
                method:'post',
                // 数据不需要编码
                contentType: false,//必须
                // 数据对象不需要转换成键值对格式
                processData: false,//必须
                data:fd,
                success:function (result) {
                    $.operate.successCallback(result);
                }
            });*!/
        $.operate.save(prefix + "/edit", $('#form-article-edit').serialize());
        }
*/

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-article-edit').serialize());
        }
    }

</script>
</body>
</html>
